package com.cby.assist.kits.ui;


import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.cby.assist.kits.IKit;
import com.cby.assist.kits.R;
import com.cby.assist.kits.widget.recyclerview.AbsViewBinder;

/**
 * @description: MainKitViewBinder
 * @author: ChenBaoYang
 * @createDate: 2022/3/7 3:17 下午
 */
public class MainKitViewBinder extends AbsViewBinder<IKit> {

    private ImageView kitIconIv;
    private TextView kitNameTv;

    public MainKitViewBinder(View view) {
        super(view);
    }

    @Override
    protected void getViews() {
        kitIconIv = itemView.findViewById(R.id.iv_kit_icon);
        kitNameTv = itemView.findViewById(R.id.tv_kit_name);
    }

    @Override
    public void bind(IKit data) {
        kitIconIv.setImageResource(data.getIcon());
        kitNameTv.setText(data.getName());
    }

    @Override
    protected void onViewClick(View view, IKit data) {
        if(data != null) {
            data.onClick(view.getContext());
        }
    }
}
